package com.geralt.im.tool;

import com.oocl.ita.winton.modle.ServerInfo;

public class HtmlBuilder {
	public static String buildHtml(ServerInfo info){
		System.out.println("buidHtml get a ingo :"+info);
		String header = "HTTP/1.1 200 OK \r\n"
				+ "Connection:keep-alive\r\n"
				+ "Content-Type:text/html\r\n\r\n";
		String html = header + "<html><head><meta charset=\"UTF-8\"><title>IM control panel</title></head><body><input type=\"button\" value=\"start\" onclick=\"window.location.href='http://localhost:8088/?START'\"><input type=\"button\" value=\"stop\" onclick=\"window.location.href='http://localhost:8088/?STOP'\"><input type=\"button\" value=\"getInfo\" onclick=\"window.location.href='http://localhost:8088/?INFO'\"><br><br><label>服务器状态：</label><lable>"+info.getServerStatus()+"</lable><br><label>运行时间:</label><label>"+info.getRunTimeLong()+"</label><br><label>启动时间:</label><label>"+info.getStrartTime()+"</label><br><label>用户列表：</label><label>"+info.userListToString()+"</label><br></body></html>";
		
		return html;
	}
}
